;(function() {
    init_parsley();

    $('#order_date').datepicker({format: 'yyyy-mm-dd',todayHighlight:true,autoclose:true , language:"zh-CN"});
    $("#form-submit").click(function(){
        var flag=$('#validate-form').parsley('validate' );
        if(flag){
            loading();
            $.post(
                "/gym/cabinet/orderWithdraw",
                $("#validate-form").serialize(),
                function(data){
                    close_loading();
                    if(data.flag){
                        $("#myModal").modal("hide");
                        toastr['success']("操作成功！", '');
                        $("#myform #btn-advanced-refresh").trigger("click");// 刷新页面
                    }else{
                        toastr['error'](data.msg,"操作失败！");
                    }
                }
            );
        }
    })
})();